﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yichat.MicroService.Interface;
using Yichat.MicroService.Model;

namespace Yichat.MicroService.Service
{
    public static class SqlLiteDatabaseCacheExtensions
    {
        public static IServiceCollection AddSqlLiteDataBaseCacheServices(this IServiceCollection services, Action<SqlLiteCacheOptions> configureOptions)
        {
            services.Configure(configureOptions);
            services.AddOptions();
            services.TryAdd(ServiceDescriptor.Singleton<IDistributeionCache, SqlLiteDatabaseCache>());
            return services;
        }
    }
}
